﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Create.Master" Inherits="System.Web.Mvc.ViewPage<Langben.DAL.Cinerarium>" %>

<%@ Import Namespace="Common" %>
<%@ Import Namespace="Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CurentPlace" runat="server">
    寄存位管理
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <input id="AreaGuid" style="display: none" />

    <div class="panel datagrid" style="width: auto;">
        <div class="panel-header">
            <div>
                选择寄存区域： 
                <select id="Area" name="Area">
                </select>
            </div>
        </div>
        <div class="panel-body" style="height: 100%;">
            <div style="padding: 10px">

                <div class="bigdiv" style="display: none">
                </div>
                <div id="CinerariumStr">
                </div>

            </div>
        </div>

    </div>


</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <style>
        ul {
            clear: both;
        }

        li {
            float: left;
            list-style-type: none;
            width: 60px;
            text-align: center;
            height: 90px;
        }
    </style>
    <script type="text/javascript">

        $(function () {
            //初始化Area的选择项
            InitArea();
            $('#Area').change(function () {
                $('#AreaGuid').val($('#Area').val());
                GetCinerariumString();
            });



        });



        function InitArea() {
            $('#Area').empty();
            $("<option></option>")
                .val("")
                .text("请选择")
                .appendTo($('#Area'));
            var url = "../CinerariumArea/GetArea";
            $.ajax({
                url: url,
                type: "Post",

                dataType: "json",
                success: function (data) {
                    if (data == null) {
                        return;
                    }
                    $.each(data, function (i, item) {
                        if (item == null) {
                            return;
                        }
                        $("<option></option>")
                            .val(item["RowGuid"])
                            .text(item["Name"])
                            .appendTo($('#Area'));
                    });
                }
            });
        }
        function GetCinerariumString() {
            $.ajax({
                url: "../Cinerarium/GetCinerariumString",
                type: "Post",
                data: { areaguid: $('#AreaGuid').val() },
                dataType: "json",
                success: function (data) {

                    $('#CinerariumStr').html(data);
                    $("input[ id^='Cinerarium'][type= 'checkbox']").hide();
                    $("input[type='checkbox']").change(function () {
                        if ($(this).attr("checked")) {
                            var entityid = $(this).val();

                            var arr = [];

                            arr.push(entityid);

                            arr.push("^");
                           
                           
                            $.ajax({
                                url: '../Cinerarium/GetFullName',
                                type: "Post",
                                data:{rowguid:entityid},
                                dataType: "text",
                                success: function (data) {
                                    
                                    arr.push(data);
                                    //主键列和显示列之间用 ^ 分割   每一项用 , 分割
                                    if (arr.length > 0) {//一条数据和多于一条
                                        returnParent(arr.join("&")); //每一项用 & 分割
                                    }
                                }
                            });

                            

                            
                        }
                    });
                }
            });
        }

    </script>
</asp:Content>

